package com.itbooking.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itbooking.entity.User;
import com.itbooking.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/list")
    public List<User> findUsers(){
        List<User> users = userService.list();
        return users;
    }

    @RequestMapping("/page")
    public Page<User> queryUsers(){
        Page page = new Page(1,10);
        Page<User> userPage = userService.page(page,null);
        return userPage;
    }

}
